package com.dongnam.quanly.common.dao;

import java.util.List;

import org.hibernate.Query;
import org.hibernate.Session;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.dongnam.quanly.common.model.ChiTietDonHang;
import com.dongnam.quanly.common.model.compkey.ChiTietDonHangId;
import com.dongnam.quanly.common.persistence.HibernateUtil;

public class ChiTietDonHangDao extends ExtendedGenericDao<ChiTietDonHang, ChiTietDonHangId> {

	private static final Logger logger = LoggerFactory.getLogger(ChiTietDonHangDao.class);

	public List<ChiTietDonHang> getListCtdh(String sodonhang) {

		String queryString = "Select ctdh from ChiTietDonHang ctdh where ctdh.donHang=:sodonhang order by ctdh.vatTuHangHoa";
		Query query = getSession().createQuery(queryString);

		query.setParameter("sodonhang", sodonhang);

		@SuppressWarnings("unchecked")
		List<ChiTietDonHang> list = query.list();
		return list;

	}
}
